﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace dotFitness.Domain
{
    public sealed class RepRange 
    {
        private RepRange() { }

        internal RepRange(int minReps, int maxReps)
        {
            this.MinReps = minReps;
            this.MaxReps = maxReps;
        }

        public int MinReps
        {
            get;
            private set;

        }
        public int MaxReps
        {
            get;
            private set;
        }

        public override bool Equals(object obj)
        {
            if (null == obj)
                return false;

            if (obj.GetType() != this.GetType())
                return false;

            if (ReferenceEquals(this, obj))
                return true;

            var other = (RepRange)obj;
            return this.MinReps == other.MinReps && this.MaxReps == other.MaxReps;
        }

        public override int GetHashCode()
        {
            return this.MinReps.GetHashCode() ^ this.MaxReps.GetHashCode();
        }

        public static bool operator ==(RepRange left, RepRange right)
        {
            if (Object.Equals(left, null))
                return (Object.Equals(right, null)) ? true : false;
            else
                return left.Equals(right);
        }

        public static bool operator !=(RepRange left, RepRange right)
        {
            return !(left == right);
        }
    }
}
